import request from '@/utils/request'

// 创建领用申请
export function createReceive(data) {
  return request({
    url: '/device/receive/create',
    method: 'post',
    data: data
  })
}

// 更新领用申请
export function updateReceive(data) {
  return request({
    url: '/device/receive/update',
    method: 'put',
    data: data
  })
}

// 删除领用申请
export function deleteReceive(id) {
  return request({
    url: '/device/receive/delete?id=' + id,
    method: 'delete'
  })
}

// 获得领用申请
export function getReceive(id) {
  return request({
    url: '/device/receive/get?id=' + id,
    method: 'get'
  })
}

// 获得领用申请分页
export function getReceivePage(query) {
  return request({
    url: '/device/receive/page',
    method: 'get',
    params: query
  })
}

// 导出领用申请 Excel
export function exportReceiveExcel(query) {
  return request({
    url: '/device/receive/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 审核领用申请
export function approveReceive(id) {
  return request({
    url: '/device/receive/approve?id=' + id,
    method: 'put'
  })
}

//撤审
export function cancelReceive(id) {
  return request({
    url: '/device/receive/cancel?id=' + id,
    method: 'put'
  })
}
